class Item:
    def __init__(self, name, area):
        self.name = name
        self.area = area

    def __str__(self):
        return f"名字为：{self.name},面积为：{self.area}"

class House:
    def __init__(self, location, area):
        self.location = location
        self.area = area
        self.residual_area = area
        self.Item = []

    def Add_item(self, itemName, itemArea):
        if self.residual_area > itemArea:
            self.Item.append(itemName)
            self.residual_area -= itemArea
        else:
            print(f"{itemName}放不下了")

    def View_all(self):
        if len(self.Item) == 0:
            print("房子中无家具")
        else:
            print(f"房子中所有家具为：{self.Item}")

    def __str__(self):
        return f"地址:{self.location}，占地面积:{self.area}，剩余面积：{self.residual_area}"


# 创建家具对象
sofa = Item("沙发", 100)
watch = Item("电视", 50)
bed = Item("床", 380)

# 创建房子对象
house = House("深圳", 500)

house.Add_item(sofa.name, sofa.area)
house.Add_item(watch.name, watch.area)
house.Add_item(bed.name, bed.area)
house.View_all()
print(house)
print(sofa)
